// ************************************************************************ //
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL     : http://localhost:8060/PAPS.APSWS/wsdl/IAPS
// Encoding : utf-8
// Version  : 1.0
// (2011-04-13 17:08:31 - - $Rev: 7300 $)
// ************************************************************************ //

unit IAPS;

interface

uses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns;

type

  // ************************************************************************ //
  // The following types, referred to in the WSDL document are not being represented
  // in this file. They are either aliases[@] of other types represented or were referred
  // to but never[!] declared in the document. The types from the latter category
  // typically map to predefined/known XML or Borland types; however, they could also 
  // indicate incorrect WSDL documents that failed to declare or import a schema type.
  // ************************************************************************ //
  // !:string          - "http://www.w3.org/2001/XMLSchema"[]
  // !:int             - "http://www.w3.org/2001/XMLSchema"[]
  // !:FuncInfo        - "urn:"[]


  // ************************************************************************ //
  // Namespace : urn:APSIntf-IAPS
  // soapAction: urn:APSIntf-IAPS#%operationName%
  // transport : http://schemas.xmlsoap.org/soap/http
  // style     : rpc
  // binding   : IAPSbinding
  // service   : IAPSservice
  // port      : IAPSPort
  // URL       : http://localhost:8060/PAPS.APSWS/soap/IAPS
  // ************************************************************************ //
  IAPS = interface(IInvokable)
  ['{6F993A7F-8167-93CC-E9C9-B3C391B4C20C}']
    function  Test: WideString; stdcall;
    function  ExceSql(const ssql: WideString; var SOutData: WideString): Integer; stdcall;
    function  CallFunc(const aFuncInfo: FuncInfo; const sData: WideString; var SOutData: WideString): Integer; stdcall;
  end;

function GetIAPS(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): IAPS;


implementation
  uses SysUtils;

function GetIAPS(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): IAPS;
const
  defWSDL = 'http://localhost:8060/PAPS.APSWS/wsdl/IAPS';
  defURL  = 'http://localhost:8060/PAPS.APSWS/soap/IAPS';
  defSvc  = 'IAPSservice';
  defPrt  = 'IAPSPort';
var
  RIO: THTTPRIO;
begin
  Result := nil;
  if (Addr = '') then
  begin
    if UseWSDL then
      Addr := defWSDL
    else
      Addr := defURL;
  end;
  if HTTPRIO = nil then
    RIO := THTTPRIO.Create(nil)
  else
    RIO := HTTPRIO;
  try
    Result := (RIO as IAPS);
    if UseWSDL then
    begin
      RIO.WSDLLocation := Addr;
      RIO.Service := defSvc;
      RIO.Port := defPrt;
    end else
      RIO.URL := Addr;
  finally
    if (Result = nil) and (HTTPRIO = nil) then
      RIO.Free;
  end;
end;


initialization
  InvRegistry.RegisterInterface(TypeInfo(IAPS), 'urn:APSIntf-IAPS', 'utf-8');
  InvRegistry.RegisterDefaultSOAPAction(TypeInfo(IAPS), 'urn:APSIntf-IAPS#%operationName%');
  InvRegistry.RegisterReturnParamNames(TypeInfo(IAPS), 'return;return;return');

end.